﻿<!DOCTYPE html>

<html class="x-admin-sm">
<head>
    <meta name="viewport" content="width=device-width" />
    <meta charset="UTF-8">
    <title>生产计划</title>
    <meta name="renderer" content=padding>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="~/js/layui/css/layui.css" rel="stylesheet" />
    <link href="~/X-admin/css/font.css" rel="stylesheet" />
    <script src="~/X-admin/lib/layui/layui.js"></script>
    <link href="~/X-admin/css/xadmin.css" rel="stylesheet" />
    <script src="~/X-admin/js/jquery.min.js"></script>
    <script src="~/X-admin/js/xadmin.js"></script>
</head>
<body>
    <div class="layui-fluid" style="width:100%;">
        <div id="bDiv">
        </div>
        <div style="float:left;width:100%;">
            <div class="layui-card">

                <div class="layui-card-body" style="margin-top:5px">
                    <form class="layui-form layui-col-space5" name="qForm" id="qForm">
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="plCode" placeholder="计划编码" autocomplete="off" class="layui-input" id="plCode">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="erpOrder" placeholder="销售订单" autocomplete="off" class="layui-input" id="erpOrder">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="cuName" placeholder="关联客户" autocomplete="off" class="layui-input" id="cuName">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="proName" placeholder="存货名称" autocomplete="off" class="layui-input" id="proName">
                        </div>
                 
                    </form>
                </div>
       

                <div class="layui-card-body layui-table-body layui-table-main" id="layui-table-main">
                    <table class="layui-hide" id="list" lay-filter="list"></table>
                </div>
            </div>


        </div>
    </div>
</body>
</html>
<script src="~/js/framework/sysframework.js"></script>
<script src="~/js/framework/commonjs.js"></script>
<script src="~/js/sysweb/planjs.js"></script>
<style>
    .layui-table th {
        background-color: rgba(17,58,172,0.5);
    }

 
</style>
<script>
    var webCode = "";

    var selectList = new Array();

    $(function () {
        webCode = getUrlVariable("menuCode");
        BannerData(webCode, "bDiv");
        DictionaryDropDown("pst", "status", "", true);
        loadData();
    })
    function openQueryWin() {
        gjQuery = true;
        InfoOpenPage("../System/QueryWeb?webCode=" + webCode, "高级检索", "85%", "80%");
    }
    function openWin() {
        InfoOpenPage("../Plan/UpdatePlanNew?dataId=0", "创建计划", "85%", "80%", true);
    }



    var cData = new Array();
    var dUrl = "../Summary/getDataList?dataType=prl&condition=";
    let nfColor = '#FFFFAA', fColor = '#C3FDB8';
    /**
     * 加载数据
     * **/
    function loadData() {

        gjQuery = false;
        layui.use('table', function () {
            var conditon = JSON.stringify(FormToJson("qForm"));
            var table = layui.table;
            table.render({
                elem: '#list'
                , height: 'full-200'   //固定高度-即固定表头固定第一行首行
                , cols: [[ //标题栏
                    { field: 'plCode', align: 'center', title: '计划编码', width: 120, rowspan: 2, fixed: 'left' }
                    , { field: 'erpOrder', align: 'center', title: '销售订单号', width: 120, rowspan: 2 }
                    , { field: 'proCode', align: 'center', title: '存货编码', width: 120, rowspan: 2 }
                    , { field: 'proName', align: 'center', title: '存货名称', width: 170, rowspan: 2 }
                    , { field: 'number', align: 'center', title: '生产数量', width: 100, rowspan: 2 }
                    , { field: 'cuName', align: 'center', title: '关联客户', width: 120, rowspan: 2 }
                    // , { field: 'gyInfo', align: 'center', title: '生产工艺', width: 150 }
                    , { title: '印 刷', align: 'center', colspan: 2 }
                    , { title: '复 合', align: 'center', colspan: 2 }
                    , { title: '分 切', align: 'center',  colspan: 2 }
                    , { title: '制 袋', align: 'center',colspan: 2 }
                ],[
                    { field: 'ysWaste', title: '废 料', align: 'center', width: 100 }
                    , { field: 'ysTotal', title: '生产数量', align: 'center', width: 120 }
                    , { field: 'fhWaste', title: '废 料', align: 'center', width: 80 }
                    , { field: 'fhTotal', title: '生产数量', align: 'center', width: 120 }
                    , { field: 'fqWaste', title: '废 料', align: 'center', width: 100 }
                    , { field: 'fqTotal', title: '生产数量', align: 'center', width: 120 }
                    , { field: 'zdWaste', title: '废 料', align: 'center', width: 100 }
                    , { field: 'zdTotal', title: '生产数量', align: 'center', width: 120 }
                ]], done: function (res, curr, count) {
                    // $("[data-field='id']").css('display', 'none');//隐藏列
                    currPage = curr;

                    $.each(res['data'], function (i, j) {
                        if (j['ysStatus'] == "1") {
                            TableTdColor('layui-table-main', i, 7, fColor);
                            TableTdColor('layui-table-main', i, 6, fColor);
                        } else if (j['ysStatus'] == "") {
                            TableTdColor('layui-table-main', i, 7, nfColor);
                            TableTdColor('layui-table-main', i, 6, nfColor);
                        }
                        if (j['fhStatus'] == "1") {
                            TableTdColor('layui-table-main', i, 9, fColor);
                            TableTdColor('layui-table-main', i, 8, fColor);
                        } 
                        else if (j['fhStatus'] == "") {
                            TableTdColor('layui-table-main', i, 8, nfColor);
                            TableTdColor('layui-table-main', i, 9, nfColor);
                        }
                        if (j['fqStatus'] == "1") {
                            TableTdColor('layui-table-main', i, 11, fColor);
                            TableTdColor('layui-table-main', i, 10, fColor);
                        } else if (j['fqStatus'] == "") {
                            TableTdColor('layui-table-main', i, 10, nfColor);
                            TableTdColor('layui-table-main', i, 11, nfColor);
                        }
                        if (j['zdStatus'] == "1") {
                            TableTdColor('layui-table-main', i, 13, fColor);
                            TableTdColor('layui-table-main', i, 12, fColor);
                        } else if (j['zdStatus'] == "") {
                            TableTdColor('layui-table-main', i, 12, nfColor);
                            TableTdColor('layui-table-main', i, 13, nfColor);
                        }
                    });
                }
                , url: dUrl + conditon
                , skin: 'row' //表格风格
                , even: true
                , page: true //是否显示分页
                , limits: [20, 25, 30]
                , limit: 20 //每页默认显示的数量
                , id: "list"
            });


        });

    }

    var qStr = "";
    /**
     * 获取高级查询字符串
     * **/
    function GetQueryPar(queryStr) {
        qStr = queryStr;
        loadData();
    }

    /**
     * 计划派工
     * **/
    function PaiGong() {
        if (cData.length > 0) {
            $.ajax({
                url: "../Plan/PlanPaiGong",
                data: { datas: JSON.stringify(cData) },
                type: "post",
                success: function (data) {
                    if (data.result) {
                        layer.alert("计划已派工", { icon: 6 });
                        loadData();
                    } else {
                        layer.msg(data.message);
                    }
                }
            });
        }
    }

    /**
     * 取消派工
     * **/
    function CancelPg() {
        if (cData.length > 0) {
            $.ajax({
                url: "../Plan/PlanCancelPaiGong",
                data: { datas: JSON.stringify(cData) },
                type: "post",
                success: function (data) {
                    if (data.result) {
                        layer.alert("计划已取消派工", { icon: 6 });
                        loadData();
                    } else {
                        layer.msg(data.message);
                    }
                }
            });
        }
    }


</script>
